<template>
    <section class="server_list_left_tab">
  
        <el-tabs type="border-card">
		  <el-tab-pane >
		    <span class="top_tab" slot="label">共享类</span>
    <el-menu
    	
      default-active="2"
      class="el-menu-vertical-demo"
      @open="openShare"
     >
	      <el-submenu :index="String(index)" v-for="(item,index) in shareTab" >
	        <template slot="title">
	          <span class="itemName">{{item.name}}</span>
	        </template>
	        <el-menu-item-group  v-show="show" >
	          	<el-menu-item @click="chooseService(itemItem.id,1)" :index="index+'_'+itemIndex" v-for="(itemItem,itemIndex) in item.items">{{itemItem.name}}</el-menu-item>
	        </el-menu-item-group>
	      </el-submenu>
    </el-menu>
		    
		  </el-tab-pane>
		  <el-tab-pane label="消息中心"  class="top_tab">
		  	 <span  class="top_tab" slot="label">采集类</span>
		  	  <el-menu
		  	  
      default-active="2"
      class="el-menu-vertical-demo"
      @open="openCollect"
     >
     
      <el-submenu :index="String(index)" v-for="(item,index) in collectTab" >
        <template slot="title">
          <span class="itemName">{{item.name}}</span>
        </template>
        <el-menu-item-group v-show="show" >
        	<!--<el-menu-item >ddawdw</el-menu-item>--> 
			<el-menu-item  @click="chooseService(itemItem.id,2)" :index="index+'_'+itemIndex" v-for="(itemItem,itemIndex) in item.items">{{itemItem.name}}</el-menu-item>
        </el-menu-item-group>
      </el-submenu>
      
    </el-menu>
		  </el-tab-pane>
		</el-tabs>
    </section>
</template>

<script>
    import {
    	computedPostDictionarySearchInfo,
    	computedPostResourceService
    } from "./computedServerList"
    export default {
    	props:{
    		businessId:{
    			type:Number,
    			default:0
    		},
    		resetLeft:Boolean
    	},
        data() {
          return {
          		show:false,
          		collectTab:[],
          		shareTab:[],
          };
        },
        mounted() {
        		computedPostDictionarySearchInfo(this);
        },
        methods:{
        	openCollect(index){
        		if(this.businessId==0){
        			alert("请选择业务类型")
        		}else{
        			console.log(index);
					computedPostResourceService(this,{
						serviceType:2,
						businessTypeIds:[this.businessId],
						infoTypeIds:[this.collectTab[index].id]
					},index)
        		}
        		
        	},
        	openShare(index){
        		if(this.businessId==0){
        			alert("请选择业务类型")
        		}else{
        			console.log(index);
	        		computedPostResourceService(this,{
						serviceType:1,
						businessTypeIds:[this.businessId],
						infoTypeIds:[this.shareTab[index].id]
					},index)
        		}
        	},
        	chooseService(id,serviceType){
        		this.$emit('chooseService',id);
        	}
        },
        watch:{
        	resetLeft(newVal){
        		computedPostDictionarySearchInfo(this);
        	}
        }
  };
</script>

<style >
	.server_list_left_tab .itemName{
		font-size: 16px;
	    font-weight: 600;
	}
	    
	
    .server_list_left_tab .el-tabs--border-card>.el-tabs__header .el-tabs__item{
    	   width: 116px;
    		text-align: center;
    }
</style>